package org.apache.dubbo.demo.consumer.example.eg6;

import org.apache.dubbo.demo.example.eg6.DemoService;
import org.apache.dubbo.rpc.RpcContext;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Application {

  @Test
  public void testLoadBalance() {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:example/eg6/applicationContext.xml");
    DemoService demoService = (DemoService) context.getBean("demoService");
    for (int i = 0; i < 10; i++) {
      String result = demoService.sayHello("xufeng");
      System.out.println("********************** result-" + i + ": " + result
          + " address: " + RpcContext.getContext().getRemoteAddress() + " **********************");
    }
  }



}
